CGI Shopping Cart

I've thought about creating a server side shopping cart for the photography website I created; http://community-info.org/sales_site.html  The idea of the website is to show that alls the actions required to support a sales site can be performed in a Java Virtual Machine, and therefore reside only on the client; no server side action! So you can understand how antithetical it would be for me to create a server side shopping cart for this site. On the other hand, I haven't done a thing with this site in 8 years, so I might as well do something with it, like add a server side shopping cart.

The original site is composed of components written by other people, that I re-engineered to work as a client side shopping site. I thought I'd follow this design paradigm by finding a server side shopping cart I could appropriate and re-engineer to work in a website designed for client side action. I'd been messing around with Perl lately, so it was natural for me to look for a shopping cart written in Perl; Selena Sol's web store. You can download Selena Sol's sales site from http://extropia.com/applications.html  There are other websites and website tools on this page, so if you are interested in building a website or want to look at some already made ones, this is a great website to visit.

I also found a book on Alibris that was written by Selena Sol, describing the details of this website; bought the book for $0.99! I followed the instructions in the book on how to get the website up and running and in a few minutes I had it running on Caprica; my Windows XP machine running IIS 5.1  I went through the motions of making a purchase on the web store, but when I got ready to submit it only tried e-mailing my order; that's what my Java site does. One of the advantages of having a server side shopping cart is that it can store the sale on a server side database and notify the site owner of the update. This is a much safer way of taking orders, since e-mail doesn't always make it through. Another feature of server side carts (though this could be worked into a client side cart) is the ability to take payment through credit card purchase.

Selena Sol's web store only e-mails you about the purchase; no different then my client side cart! I wanted visitors to my site to be able to use credit cards. Credit card companies charge you for their web services, but  I heard that PayPal can take care of the whole transaction and only takes their cut at the time of the sale. This is what I wanted, since I wasn't actually planning on making sales, just creating the site. I took a look at the PayPal site and they actually have a cart you can incorporate in your web page with the addition of a few lines of JavaScript! So I took out the shopping cart in my site, took out the shopping cart controls and added the PayPal shopping cart. How easy can it get?

 

Unfortunately the PayPal shopping cart is designed for a single item on a single page, or you could use a drop down for multiple items; not what I want and definitely not compatible with the slideshows on my website; you can purchase each picture that appears in the slideshow when they appear - or you can order directly by clicking on the picture number (an alphanumeric string) that appears in the shopping cart (OK, I have a list too, but you don't have to use it). Fortunately there was an easy solution. I added a few lines of code to the Java routine that updates the picture label when the applet changes picture slides. This routine knows what slide is being displayed, so I had it just pass this string value to a JavaScript routine on the web page where the applet is running. The JavaScript routine dynamically inserts the name of the slide into the cart, so it appears in the sales receipt when you make the purchase; I'll know what you intended to buy. Check it out at http://community-info.org/PictureSales/index.html  One warning: this was originally written on a 32 bit machine and ported to Serval, a 64 bit machine running 64 bit Windows, a 64 bit web server, ..., 64 bit everything. If you look at the site from a 32 bit machine everything looks OK. If you look at the site from a machine like Serval you need to use a 64 bit browser to see the slide shows. There's probably a way to get Serval like machines to view the slideshows with a 32 bit browser, but that will be part of another personal blog/programs.

The protocol I use for communication between Java and JavaScript is called LiveConnect. There is another method that can be used for Java-JavaScript communication; the Java DOM API. I used LiveConnect because I've used it in the past and it works; go with what you know. ...and since it works there is no reason for adding a full blown Perl shopping cart to my site.  ...but what about Selena Sol's website? It was originally on Caprica, but I've moved my website since then to Serval; a PC with an AMD quadcore processor running Windows 7 and hence the IIS 7.5 web server.  I moved Selena Sol's website to Serval last night and had to make several changes to get it to run. Some of the changes I made weren't necessary (in other words, I used the hit and miss technique to find the correct changes to make) so problems might pop up on the sales site, but as far as I know of this writing it's 100% functional (on second thought, I know what could've been screwed up - the word search could find parts of the site I need to change back - I'll attend to that later); http://community-info.org/web_store/web_store.cgi

 

Return To My List Of Blogs      Return To My List Of Programs